package com.jiudu.gulimall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;

import com.jiudu.common.valid.ListValue;
import com.jiudu.common.valid.addGroup;
import com.jiudu.common.valid.updateGroup;
import com.jiudu.common.valid.updateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 * 
 * @author jiudu
 * @email zgf_java@163.com
 * @date 2020-11-21 20:54:19
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 * 品牌id
	 */
	@NotNull(message = "修改必须指定品牌ID",groups = updateGroup.class)
	@Null(message = "新增不需要指定品牌ID",groups = addGroup.class)
	@TableId
	private Long brandId;
	/**
	 * 品牌名
	 */
	@NotBlank(message = "品牌名必须提交且不能为空",groups = {updateGroup.class,addGroup.class})
	private String name;
	/**
	 * 品牌logo地址
	 */
	@NotBlank(message = "logo不能为空",groups = addGroup.class)
	@URL(message = "logo地址必须是一个合法的地址",groups = {addGroup.class,updateGroup.class})
	private String logo;
	/**
	 * 介绍
	 */
	private String descript;
	/**
	 * 显示状态[0-不显示；1-显示]
	 */
	@NotNull(message = "显示状态不能为空",groups = {addGroup.class, updateStatusGroup.class})
	@ListValue(value = {0,1},groups = {addGroup.class, updateStatusGroup.class})
	private Integer showStatus;
	/**
	 * 检索首字母
	 */
	@Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是一个字母",groups = {addGroup.class,updateGroup.class})
	private String firstLetter;
	/**
	 * 排序
	 */
	@Min(value = 0,message = "排序字段必须大于等于0")
	private Integer sort;

}
